<?php echo form_tag('@admin?module=post&action=edit', array(
  'id'        => 'sf_admin_edit_form',
  'name'      => 'sf_admin_edit_form',
  'multipart' => true,
)) ?>

<?php echo object_input_hidden_tag($post, 'getId') ?>

<fieldset id="sf_fieldset_none" class="">

<div class="form-row">
  <?php echo label_for('post[i18n]', __($labels['post{i18n}']), '') ?>
  <div class="content<?php if ($sf_request->hasError('post{i18n}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('post{i18n}')): ?>
    <?php echo form_error('post{i18n}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php include_partial('i18n', array('post' => $post, 'languages' => $languages)); ?>
    </div>
</div>

<div class="form-row">
  <?php echo label_for('post[tags]', __($labels['post{tags}']), '') ?>
  <div class="content<?php if ($sf_request->hasError('post{tags}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('post{tags}')): ?>
    <?php echo form_error('post{tags}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

<?php echo input_auto_complete_tag('post[tags]', $post->getTagPhrase(),
    '@admin?module=post&action=tags',
    array('autocomplete' => 'off', 'size' => '80'),
    array('use_style'    => true, 'tokens' => ' ')
  ); ?>    </div>
</div>

<div class="form-row">
  <?php echo label_for('post[images]', __($labels['post{images}']), '') ?>
  <div class="content<?php if ($sf_request->hasError('post{images}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('post{images}')): ?>
    <?php echo form_error('post{images}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php include_partial('images', array('post' => $post, 'languages' => $languages)); ?>
    </div>
</div>

<div class="form-row">
  <?php echo label_for('post[handle]', __($labels['post{handle}']), 'class="required" ') ?>
  <div class="content<?php if ($sf_request->hasError('post{handle}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('post{handle}')): ?>
    <?php echo form_error('post{handle}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <div id="handle-field"><?php include_partial('post/handle', array('handle' => $post->getHandle())); ?></div>
  
  <div><?php echo submit_to_remote('ajax_submit', __('Auto-handle'), array(
                 'url'      => '@admin?module=post&action=handle',
                 'update'   => 'handle-field',
                 'complete' => visual_effect('highlight', 'handle-input'),
            )); ?>
  <?php echo submit_to_remote('ajax_submit', __('Check uniqueness'), array(
                 'url'      => '@admin?module=post&action=unique',
                 'update'   => 'handle-unique',
                 'complete' => visual_effect('highlight', 'handle-unique'),
            )); ?>
  <span id="handle-unique"></span>
  </div>
            
  </div>    
</div>

<div class="form-row">
  <?php echo label_for('post[datetime]', __($labels['post{datetime}']), '') ?>
  <div class="content<?php if ($sf_request->hasError('post{datetime}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('post{datetime}')): ?>
    <?php echo form_error('post{datetime}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php $value = object_input_date_tag($post, 'getDatetime', array (
  'rich' => true,
  'calendar_button_img' => '/sf/sf_admin/images/date.png',
  'control_name' => 'post[datetime]',
)); echo $value ? $value : '&nbsp;' ?>
    </div>
</div>

<div class="form-row">
  <?php echo label_for('post[published]', __($labels['post{published}']), 'class="required" ') ?>
  <div class="content<?php if ($sf_request->hasError('post{published}')): ?> form-error<?php endif; ?>">
  <?php if ($sf_request->hasError('post{published}')): ?>
    <?php echo form_error('post{published}', array('class' => 'form-error-msg')) ?>
  <?php endif; ?>

  <?php $value = object_checkbox_tag($post, 'getPublished', array (
  'control_name' => 'post[published]',
)); echo $value ? $value : '&nbsp;' ?>
    </div>
</div>

</fieldset>

<?php include_partial('edit_actions', array('post' => $post)) ?>

</form>

<ul class="sf_admin_actions">
      <li class="float-left"><?php if ($post->getId()): ?>
<?php echo button_to(__('delete'), '@admin?module=post&action=delete&id='.$post->getId(), array (
  'post' => true,
  'confirm' => __('Are you sure?'),
  'class' => 'sf_admin_action_delete',
)) ?><?php endif; ?>
</li>
  </ul>
